package com.shengqin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shengqin.config.handlers.TestDateRangeTypeHandler;
import com.shengqin.config.handlers.UploadFileModelTypeHandler;
import com.shengqin.pojo.plan.UploadFileModel;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName(value = "t_free_test_apply",autoResultMap = true)
public class FreeTestApply {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private Integer planId;
    private String reservationId;
    private String studyCode;
    private String name;
    private String sex;
    private String gradeId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    private String reason;
    @TableField(value = "upload_file_list", typeHandler = UploadFileModelTypeHandler.class)
    private List<UploadFileModel> uploadFileList;
    private Integer state;
    private String refundReason;

    @TableField(exist = false)
    private String stateDesc;

    public String getStateDesc(){
        if(state == 1){
            return "待审核";
        } else if(state == 2) {
            return "审核通过";
        } else if(state == 3){
            return "审核失败";
        }
        return "";
    }
}
